var loading_gif = "images/loading.gif";
function setLoadingGif(gif)
{
	loading_gif = gif;
}
function beginpopup()
{
  var div=document.getElementById("mypopmodalBackground");
  if(!div)
  {
    div = document.createElement('div'); 
    div.id = "mypopmodalBackground";
    div.style.zIndex = 10000;
    document.body.appendChild(div); 
  }
  
 div.innerHTML = "<table width=100% height='500px' border=0 ><tr><td align=center valign=middle><img src='"+loading_gif+"' /></td></tr></table>";
 var h = document.body.clientHeight; 
 var w = document.body.clientWidth;

 if(h<(document.body.scrollHeight))
   h = document.body.scrollHeight;
 if(w<(document.body.scrollWidth))
   w = document.body.scrollWidth;
  
 div.style.position="absolute";
 div.style.height=h+"px";
 div.style.width=w+"px";
 div.style.zIndex =1000000;
 div.style.display='block';
 //div.style.visibility="visible";
 //div.style.display='';
 //div.className="modalBackground";
}

function resizepopup()
{
	if(endpopup())
	{
		//beginpopup();
		window.setTimeout(beginpopup,5);
	}
}

function endpopup()
{
  var div=document.getElementById("mypopmodalBackground");
  if(!div)
  {
  	return false;
  }
  div.style.display='none';
  document.body.removeChild(div);
  
  return true;
}
